// 获取选中的ID
let catArr= []
let catObj = []
function formPidArr () {
    let list = document.querySelectorAll('ul.specify')
    for(let item of list) {
        let attr = item.getAttribute('data-pid')
        catObj[attr] = []
    }
}

function formCateObj (dataPid, dataId) {
    let toggleIndex = -1
    catObj[dataPid].findIndex((e, index, array) => {
        if (e == dataId) toggleIndex = index
    })
    if (toggleIndex > -1) catObj[dataPid].splice(toggleIndex, 1)
    else catObj[dataPid].push(dataId)
    console.log(catObj)
    console.log([{a:[1,2]},{ b: [1,2]}])
}

function formCateArr () {

}
function getCate(){
    let target = window.event.target
    if(target.nodeName == 'LI') { 
        let dataPid = target.parentNode.getAttribute('data-pid')
        let dataId = target.getAttribute('data-id')
        var hasPid = catArr.hasOwnProperty(dataPid);
        // console.log(catObj)
        formCateObj(dataPid, dataId)
        
        
        formCateArr()
        

         
    }
}


!(function(){
    formPidArr()
})()